package com.iqiyi.dbagent.base.sources.impl;

import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.iqiyi.dbagent.base.config.MySqlConfig;
import com.iqiyi.dbagent.base.sources.i.AbstractDataSource;

public class DruidSourceMysql extends AbstractDataSource {

	private volatile static DruidSourceMysql instance;	
	
	
	private DruidSourceMysql() throws Exception {
		dataSource = DruidDataSourceFactory.createDataSource(MySqlConfig.getInstance().getP());		
	}

	public static DruidSourceMysql getInstance() throws Exception {
		if (instance == null) {
			synchronized (DruidSourceMysql.class) {
				if (instance == null) {
					instance = new DruidSourceMysql();
				}
			}
		}
		return instance;
	}
}
